IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetChiefCodes]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetChiefCodes]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


/***************************************************************************
* Name:			GetChiefCodes
* Purpose:		Returns all the chief codes for the specified institution. 
*
*
* PARAMETERS
* Name			Description					
* -------------		-----------------------------------------------------------
* @institutionId				InstitutionId
***************************************************************************/

CREATE PROCEDURE dbo.[GetChiefCodes]
(
	@institutionId INT
)
AS
BEGIN
	SET NOCOUNT ON

	select distinct chiefcode from dbo.FwkDomainOrganization
	where institutionid = @institutionId and chiefcode is not null

	SET NOCOUNT OFF
END

GO
